package com.ysd.lis.controller.sys;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.SysExtenFieldsValue;
import com.ysd.lis.request.ExtenFieldsValuePageRequestDto;
import com.ysd.lis.request.ExtenFieldsValueResponseDto;
import com.ysd.lis.service.SysExtenFieldsValueService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 扩展字段值 前端控制器
 * </p>
 *
 * @author Cfz
 * @since 2023-12-22
 */
@Api(value = "扩展属性值")
@RestController
@RequestMapping("/api/sys/sysextenfieldsvalue")
public class SysExtenFieldsValueController extends BaseController {
    @Autowired
    private SysExtenFieldsValueService sysExtenFieldsValueService;

    @ApiOperation("获取扩展属性结构数据")
    @GetMapping("/findExtenFieldsValueList")
    public Result findExtenFieldsValueList(ExtenFieldsValuePageRequestDto pageParam) throws JsonProcessingException {
        return sysExtenFieldsValueService.findExtenFieldsValueList(pageParam);
    }

    @ApiOperation("保存扩展属性值")
    @PostMapping("/saveEditExtenFieldsValueList")
    public Result saveEditExtenFieldsValueList(@RequestBody ExtenFieldsValueResponseDto input) throws JsonProcessingException {
        return sysExtenFieldsValueService.saveEditExtenFieldsValueList(input);
    }

    @ApiOperation("添加扩展属性")
    @PostMapping("/addExtenFieldsValue")
    public Result addExtenFieldsValue(@RequestBody SysExtenFieldsValue ExtenFieldsValue) {
        return sysExtenFieldsValueService.addExtenFieldsValue(ExtenFieldsValue);
    }

    @ApiOperation("编辑扩展属性")
    @PostMapping("/editExtenFieldsValue")
    public Result editExtenFieldsValue(@RequestBody SysExtenFieldsValue ExtenFieldsValue) {
        return sysExtenFieldsValueService.editExtenFieldsValue(ExtenFieldsValue);
    }

    @ApiOperation("删除扩展属性")
    @PostMapping("/deleteExtenFieldsValue")
    public Result deleteExtenFieldsValue(@RequestBody SysExtenFieldsValue ExtenFieldsValue) {
        return sysExtenFieldsValueService.deleteExtenFieldsValue(ExtenFieldsValue);
    }
}
